
import {
  Column,
  Entity,
  PrimaryGeneratedColumn,
  BeforeInsert,
  CreateDateColumn,
  Generated,
  OneToOne,
  JoinColumn,
  ManyToOne,
  UpdateDateColumn,
  OneToMany,
} from 'typeorm'
import { Post } from 'src/post/entities/post.entity'
// import { User } from 'src/user/entities/user.entity'

@Entity()
export class Commit { 

  @PrimaryGeneratedColumn('uuid')
  id: string

  @Column({ type: 'text' })
  content!: string



  @ManyToOne(() => Post, (post) => post.commits)
  @JoinColumn()
  post: Post


  // @ManyToOne(() => User, (user) => user.commits)
  // @JoinColumn()
  // user: User

  @Column({ type: 'varchar' })
  userId!: string
    
  @CreateDateColumn({ type: 'timestamp', update: false, comment: '创建时间' })
  create_time: Date
  @UpdateDateColumn({ type: 'timestamp', update: true, comment: '更新时间' })
  update_time: Date


}
